package com.aspose.cells.b.a.b.a;

import com.aspose.cells.b.a.b.zm;
import com.aspose.cells.b.a.b.zn;
import com.aspose.cells.b.a.b.zo;
import com.aspose.cells.b.a.b.zp;
import com.aspose.cells.b.a.b.zq;
import com.aspose.cells.b.a.b.zv;
import java.awt.Graphics2D;
import java.awt.Shape;
import java.awt.font.TextLayout;
import java.awt.geom.AffineTransform;
import java.awt.geom.PathIterator;
import java.awt.geom.Arc2D.Double;
import java.awt.geom.Ellipse2D.Float;

public class ze extends com.aspose.cells.b.a.b.e.za {
   private com.aspose.cells.b.a.b.a.a.za a;

   public ze() {
      this(0);
   }

   public ze(com.aspose.cells.b.a.b.a.a.za var1) {
      super(var1);
      this.a = var1;
   }

   public ze(int var1) {
      this(new com.aspose.cells.b.a.b.a.a.za());
      this.a(var1);
   }

   public ze(zo[] var1, byte[] var2) {
      this(var1, var2, 0);
   }

   public ze(zo[] var1, byte[] var2, int var3) {
      this(new com.aspose.cells.b.a.b.a.a.za());
      this.a(var3);
      this.a(var1, var2);
   }

   protected Object clone() {
      return new ze((com.aspose.cells.b.a.b.a.a.za)((com.aspose.cells.b.a.b.a.a.za)this.a().clone()));
   }

   public com.aspose.cells.b.a.b.a.a.za a() {
      return this.a;
   }

   public void a(int var1) {
      if (var1 == 0) {
         this.a().a(0);
      } else {
         this.a().a(1);
      }

   }

   public zj b() {
      return this.a().g();
   }

   public zo[] c() {
      return this.b().a();
   }

   public byte[] d() {
      return this.b().b();
   }

   public int e() {
      return this.a().f();
   }

   public ze f() {
      return (ze)this.clone();
   }

   public void g() {
   }

   public void h() {
      this.g();
   }

   public void a(zq var1, float var2, float var3) {
      this.a(var1.f(), var1.g(), var1.h(), var1.i(), var2, var3);
   }

   public void a(float var1, float var2, float var3, float var4, float var5, float var6) {
      Object var7 = null;
      if (var6 >= 360.0F) {
         var7 = new Float(var1, var2, var3, var4);
      } else {
         double var8 = (double)(var3 / var4);
         double var10 = var8 * var8;
         double var12 = a(var10, (double)var5);
         double var14 = a(var10, (double)(var5 + var6)) - var12;
         var7 = new Double((double)var1, (double)var2, (double)var3, (double)var4, -var12, -var14, 0);
      }

      this.a().a((Shape)var7);
   }

   public void a(zo var1, zo var2, zo var3, zo var4) {
      this.a(var1.d(), var1.e(), var2.d(), var2.e(), var3.d(), var3.e(), var4.d(), var4.e());
   }

   public void a(float var1, float var2, float var3, float var4, float var5, float var6, float var7, float var8) {
      java.awt.geom.CubicCurve2D.Float var9 = new java.awt.geom.CubicCurve2D.Float(var1, var2, var3, var4, var5, var6, var7, var8);
      this.a().a((Shape)var9);
   }

   public void a(float var1, float var2, float var3, float var4) {
      Float var5 = new Float(var1, var2, var3, var4);
      this.a().a((Shape)var5, false);
   }

   public void a(zq var1) {
      this.a(var1.f(), var1.g(), var1.h(), var1.i());
   }

   public void b(float var1, float var2, float var3, float var4) {
      java.awt.geom.Line2D.Float var5 = new java.awt.geom.Line2D.Float(var1, var2, var3, var4);
      this.a().a((Shape)var5);
   }

   public void a(zo var1, zo var2) {
      this.b(var1.d(), var1.e(), var2.d(), var2.e());
   }

   public void a(zo[] var1) {
      if (var1 == null) {
         throw new IllegalArgumentException("points can not be null");
      } else if (var1.length != 0) {
         if (this.a().e()) {
            this.a().b(var1[0].d(), var1[0].e());
         } else {
            this.a().a(var1[0].d(), var1[0].e());
         }

         for(int var2 = 1; var2 < var1.length; ++var2) {
            this.a().a(var1[var2].d(), var1[var2].e());
         }

      }
   }

   public void b(float var1, float var2, float var3, float var4, float var5, float var6) {
      Object var7 = null;
      if (var6 >= 360.0F) {
         var7 = new Float(var1, var2, var3, var4);
      } else {
         double var8 = (double)(var3 / var4);
         double var10 = var8 * var8;
         double var12 = a(var10, (double)var5);
         double var14 = a(var10, (double)(var5 + var6)) - var12;
         var7 = new Double((double)var1, (double)var2, (double)var3, (double)var4, -var12, -var14, 2);
      }

      this.a().a((Shape)var7, false);
   }

   public void a(zp var1, float var2, float var3) {
      this.b((float)var1.c(), (float)var1.d(), (float)var1.e(), (float)var1.f(), var2, var3);
   }

   public void b(zo[] var1) {
      if (var1 == null) {
         throw new IllegalArgumentException("points can not be null");
      } else if (var1.length < 3) {
         throw new IllegalArgumentException("Invalid parameter used. points.length can not be less than three.");
      } else {
         this.a().b(var1[0].d(), var1[0].e());

         for(int var2 = 1; var2 < var1.length; ++var2) {
            this.a().a(var1[var2].d(), var1[var2].e());
         }

         this.a().h();
      }
   }

   public void c(float var1, float var2, float var3, float var4) {
      this.a().b(var1, var2);
      this.a().a(var1 + var3, var2);
      this.a().a(var1 + var3, var2 + var4);
      this.a().a(var1, var2 + var4);
      this.a().h();
   }

   public void b(zq var1) {
      this.c(var1.f(), var1.g(), var1.h(), var1.i());
   }

   public void a(ze var1, boolean var2) {
      if (this.a().e() || var1.a().e()) {
         var2 = false;
      }

      this.a().a((Shape)var1.a(), var2);
   }

   public void a(zi var1) {
      if (var1 != null) {
         this.a().a(var1.a());
      }
   }

   public void c(zo[] var1) {
      this.a(var1, 0.5F);
   }

   public void a(zo[] var1, float var2) {
      this.a(var1, 0, var1.length - 1, var2);
   }

   public void a(zo[] var1, int var2, int var3, float var4) {
      int var5 = var3 + 1;
      int var6 = var5 * 2 + 4;
      float[] var7 = new float[var6];
      int var8 = var2 + var5;
      if (var8 == var1.length) {
         --var8;
         --var6;
         var7[var6] = var1[var8].e();
         --var6;
         var7[var6] = var1[var8].d();
      }

      while(var6 > 0 && var8 >= 0) {
         --var6;
         var7[var6] = var1[var8].e();
         --var6;
         var7[var6] = var1[var8].d();
         --var8;
      }

      if (var6 > 0) {
         var7[1] = var1[0].e();
         var7[0] = var1[0].d();
      }

      this.a(var7, !this.a().e(), var4);
   }

   void a(float[] var1, boolean var2, float var3) {
      var3 /= 3.0F;
      if (var2) {
         this.a().a(var1[2], var1[3]);
      } else {
         this.a().b(var1[2], var1[3]);
      }

      float var4 = var1[4] - var1[0];
      float var5 = var1[5] - var1[1];
      float var6 = var1[2] + var3 * var4;
      float var7 = var1[3] + var3 * var5;
      int var8 = 2;

      for(int var9 = var1.length - 4; var8 < var9; var8 += 2) {
         int var10 = var8 + 1;
         int var12 = var10++;
         int var13 = var10++;
         int var14 = var10++;
         int var15 = var10++;
         int var16 = var10++;
         var4 = var1[var15] - var1[var8];
         var5 = var1[var16] - var1[var12];
         float var17 = var1[var13] - var3 * var4;
         float var18 = var1[var14] - var3 * var5;
         this.a().a(var6, var7, var17, var18, var1[var13], var1[var14]);
         var6 = var1[var13] + var3 * var4;
         var7 = var1[var14] + var3 * var5;
      }

   }

   public void a(String var1, com.aspose.cells.b.a.b.zh var2, int var3, float var4, zn var5, zv var6) {
      this.a(var1, new com.aspose.cells.b.a.b.zg(var2, var4, var3, 0), (float)var5.a(), (float)var5.b(), java.lang.Float.POSITIVE_INFINITY, java.lang.Float.POSITIVE_INFINITY, var6);
   }

   void a(String var1, com.aspose.cells.b.a.b.zg var2, float var3, float var4, float var5, float var6, zv var7) {
      com.aspose.cells.b.a.b.d.a.zd var8 = new com.aspose.cells.b.a.b.d.a.zd(var1, var2, var7, var5, var6, (Graphics2D)null);
      int var9 = this.a().d();

      for(com.aspose.cells.b.a.b.d.a.zc var10 = var8.m(); var10 != null; var10 = var8.m()) {
         TextLayout var11 = new TextLayout(var10.k(), var2.a(), var8.a().getFontRenderContext());
         AffineTransform var12 = (AffineTransform)var8.l().clone();
         if (var8.g().f()) {
            var12.translate((double)(var4 + var10.g()), (double)(-(var3 + var10.h())));
         } else {
            var12.translate((double)(var3 + var10.h()), (double)(var4 + var10.g()));
         }

         this.a().a(var11.getOutline(var12), false);
      }

      AffineTransform var13 = var8.n();
      if (var13 != null) {
         this.a().a(var13, var9, this.a().d() - var9);
      }

   }

   public void i() {
      if (!this.a().e()) {
         this.a().h();
      }

   }

   public void j() {
      this.a().k();
   }

   public void a(zm var1) {
      this.a((zm)var1, (zi)null);
   }

   public void a(zm var1, zi var2) {
      this.a(var1, var2, 0.6666667F);
   }

   public void a(zm var1, zi var2, float var3) {
      if (var1 == null) {
         throw new IllegalArgumentException("pen");
      } else {
         this.a((Shape)(new com.aspose.cells.b.a.b.a.a.za(var1.s().createStrokedShape(this))));
         this.a(var2, var3);
      }
   }

   public void a(zi var1, float var2) {
      AffineTransform var3 = null;
      if (var1 != null) {
         var3 = var1.a();
      }

      PathIterator var4 = this.a().getPathIterator(var3, (double)var2);
      com.aspose.cells.b.a.b.a.a.za var5 = new com.aspose.cells.b.a.b.a.a.za();
      var5.a(var4, false);
      this.a((Shape)var5);
   }

   private void a(zo[] var1, byte[] var2) {
      this.a().l();
      if ((var2[0] & 7) != 0) {
         this.a().b(var1[0].d(), var1[0].e());
      }

      for(int var3 = 0; var3 < var1.length; ++var3) {
         switch(var2[var3] & 7) {
         case 0:
            this.a().b(var1[var3].d(), var1[var3].e());
            break;
         case 1:
            this.a().a(var1[var3].d(), var1[var3].e());
         case 2:
         default:
            break;
         case 3:
            float var4 = var1[var3].d();
            float var5 = var1[var3].e();
            ++var3;
            float var6 = var1[var3].d();
            float var7 = var1[var3].e();
            ++var3;
            float var8 = var1[var3].d();
            float var9 = var1[var3].e();
            this.a().a(var4, var5, var6, var7, var8, var9);
         }

         if ((var2[var3] & 128) != 0) {
            this.a().h();
         }

         if ((var2[var3] & 32) != 0) {
            this.a().j();
         }
      }

   }

   private static double a(double var0, double var2) {
      double var4 = Math.toRadians(var2);
      double var6 = Math.tan(var4);
      double var8 = 1.0D / Math.sqrt(var0 * var6 * var6 + 1.0D);
      double var10 = Math.acos(var8);
      double var12 = Math.toDegrees(var10);
      int var14 = Math.abs((int)var2) / 90;
      switch(var14 & 3) {
      case 1:
         var12 = 180.0D - var12;
         break;
      case 2:
         var12 += 180.0D;
         break;
      case 3:
         var12 = 360.0D - var12;
      }

      if (var2 < 0.0D) {
         var12 = -var12;
      }

      var12 += (double)((int)var2 / 360 * 360);
      return var12;
   }
}
